// pages/video/video.js
import request from '../../utils/request.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    videoListData:[],
    navId:'',//导航的标识
    videoList:[],//视频列表数据
    videoId:'', //视频ID标识
    isTrigger: false,  //设置当前下拉刷新状态，true 表示下拉刷新已经被触发，false 表示下拉刷新未被触发
    videoTimeObjList:[]  //存贮播放过的视频的ID以及播放时间
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getVideoList();
  },
  // 请求导航栏数据
  async  getVideoList(){
      let res =await request('/video/group/list');
      this.setData({videoListData:res.data.slice(0,14)});
      this.setData({
        navId:res.data[0].id
      });
    // 只有navId被赋值后才能调用   getVideoGroup()
    this.getVideoGroup(this.data.navId)
    },
  // 点击导航栏绑定样式
  getId(event) {
    this.setData({
      navId: event.currentTarget.id * 1   //*1将字符串转换为数字
    })
    this.getVideoGroup(this.data.navId)
    //开启等待提示框
    wx.showLoading({
      title:'正在努力加载',
      mask:true
    })
  },

  //获取视频标签下对应的视频数据
  async getVideoGroup(navId){
    let res =await request('/video/group', {id: navId});
    //console.log(res)
    let index = 0;
    let ress = res.datas.map((item)=>{item.id = index++; 
    return item
    })
    this.setData({
      videoList:ress,
      isTrigger:false
    })
    console.log(ress)
    // 当视频数据获取成功后，关闭等待提示框
    wx.hideLoading({})
  },

  // 控制页面只能播放一个视频
  // 点击播放/继续播放的回调
  handlePlay(event){
    // 需求
    // 1.在点击播放的事件中需要找到上一个播放的视频
      // 2.在播放新的视频之前需要关闭前一个视频
    // 关键
      // 1.如何找到上一个视频的实例对象
      // 2.如何判断确认点击的视频和正在播放的视频不是同一个视频
    // 单例模式
      // 1.需要创建多个对象的场景下，通过一个变量接受，始终保持只有一个对象
      // 2.节省内存空间
      // this是video页面的实例对象
    let vid = event.currentTarget.id;

    // 当this.videoContext有值时,点击的两个视频不一样时关闭上一个视频
    // if(this.videoContext && vid!==this.vid){
    //   //调用的是上一个video的实例的stop方法
    //   this.videoContext.stop();
    // }
    this.setData({videoId:vid})
    // 利用this存储上一个video的id值
    //this.vid = vid;
    // 利用this存储上一个video的实例
    this.videoContext = wx.createVideoContext(vid)
    // 判断当前的视频是否有播放记录  如果有，跳转至指定的播放位置
    let { videoTimeObjList} = this.data;
    let videoItem = videoTimeObjList.find(item=>item.vid == vid)
    if(videoItem){
      this.videoContext.seek(videoItem.currentTime)
    }
  
    this.videoContext.play()
    // console.log(vid)
    // console.log(videoContext)
  },
// scroll-view下拉时刷新
  handleRefresh(){
    console.log('aaa')
    // 再次发请求获取数据
    this.getVideoGroup(this.data.navId)
  },
  //scroll-view 上拉加载
  handleTolower(){
    console.log('bbb');
    let datas = [
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_70C16DCF0556496953632D0A0419E9A0",
          "coverUrl": "https://p1.music.126.net/cFWs-BHaHw0RJKUln7Mmpw==/109951163572847553.jpg",
          "height": 720,
          "width": 1280,
          "title": "巴西超美小姐姐翻唱传奇哥经典《All of Me》，好听醉了，超享受！",
          "description": "巴西超美小姐姐 Luciana Zogbi 翻唱传奇哥经典《All of Me》，好听醉了，超享受！",
          "commentCount": 221,
          "shareCount": 647,
          "resolutions": [
            {
              "resolution": 240,
              "size": 32034061
            },
            {
              "resolution": 480,
              "size": 45741226
            },
            {
              "resolution": 720,
              "size": 73073142
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 340000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/C6VID_CReqmt8ETsUWaYTQ==/18499283139231828.jpg",
            "accountStatus": 0,
            "gender": 0,
            "city": 340100,
            "birthday": -2209017600000,
            "userId": 479954154,
            "userType": 207,
            "nickname": "音乐诊疗室",
            "signature": "当我坐在那架破旧古钢琴旁边的时候，我对最幸福的国王也不羡慕。（合作推广请私信，或者+V信：mjs927721）",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 18499283139231828,
            "backgroundImgId": 1364493978647983,
            "backgroundUrl": "http://p1.music.126.net/i4J_uvH-pb4sYMsh4fgQAA==/1364493978647983.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": {
              "1": "音乐视频达人",
              "2": "音乐资讯达人"
            },
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "18499283139231828",
            "backgroundImgIdStr": "1364493978647983"
          },
          "urlInfo": {
            "id": "70C16DCF0556496953632D0A0419E9A0",
            "url": "http://vodkgeyttp9c.vod.126.net/vodkgeyttp8/bgjjJFNq_129938158_shd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=SYoDTkyeRtpdbByolYtmLxRcXQzkgxdJ&sign=2135bc8971c707f5013e2c80dd5cbf9e&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 73073142,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 58109,
              "name": "国外达人",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 14137,
              "name": "感动",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "All of Me",
              "id": 27556211,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 35342,
                  "name": "John Legend",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": "",
              "fee": 1,
              "v": 97,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 2635125,
                "name": "Love In The Future",
                "picUrl": "http://p3.music.126.net/xbhqfih88eVMAIItjBC81Q==/109951165968631390.jpg",
                "tns": [],
                "pic_str": "109951165968631390",
                "pic": 109951165968631400
              },
              "dt": 269609,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 10785480,
                "vd": -43218
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 6471306,
                "vd": -40587
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 4314218,
                "vd": -38816
              },
              "a": null,
              "cd": "1",
              "no": 6,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 1,
              "s_id": 0,
              "rtype": 0,
              "rurl": null,
              "mst": 9,
              "cp": 7001,
              "mv": 191009,
              "publishTime": 1377792000000,
              "privilege": {
                "id": 27556211,
                "fee": 1,
                "payed": 0,
                "st": 0,
                "pl": 0,
                "dl": 0,
                "sp": 0,
                "cp": 0,
                "subp": 0,
                "cs": false,
                "maxbr": 320000,
                "fl": 0,
                "toast": false,
                "flag": 4,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "70C16DCF0556496953632D0A0419E9A0",
          "durationms": 278593,
          "playTime": 351144,
          "praisedCount": 2591,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_1229CEED6BB05E9B6A5C352212E553A8",
          "coverUrl": "https://p1.music.126.net/aB8u2p0Uk8nKnkOFqhg3pw==/109951164929205049.jpg",
          "height": 952,
          "width": 540,
          "title": "gul belan. nur",
          "description": null,
          "commentCount": 2,
          "shareCount": 6,
          "resolutions": [
            {
              "resolution": 240,
              "size": 5752900
            },
            {
              "resolution": 480,
              "size": 10166523
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 650000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/a68ogxnDtvJLXuGtd_P4eA==/109951165826010326.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 653200,
            "birthday": 957110400000,
            "userId": 569053940,
            "userType": 0,
            "nickname": "APDm1",
            "signature": "",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951165826010320,
            "backgroundImgId": 109951163742096960,
            "backgroundUrl": "http://p1.music.126.net/ZueXaV1uYIvzMCyVbcV4Ew==/109951163742096953.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951165826010326",
            "backgroundImgIdStr": "109951163742096953"
          },
          "urlInfo": {
            "id": "1229CEED6BB05E9B6A5C352212E553A8",
            "url": "http://vodkgeyttp9c.vod.126.net/cloudmusic/XcTmEEam_2978266298_hd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=zKRafHdeSpxlDjOuRQqLYmKWRjrZBjar&sign=ce0561fcfc3d0aa49c9f59c67d53f858&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 10166523,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 480
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 57113,
              "name": "国人男声",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "Gul bilan nur",
              "id": 1425099615,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 12002065,
                  "name": "Rangsiz",
                  "tns": [],
                  "alias": []
                },
                {
                  "id": 1198116,
                  "name": "GalipWulam",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": "",
              "fee": 8,
              "v": 14,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 85880635,
                "name": "Gul bilan nur",
                "picUrl": "http://p3.music.126.net/EEs3Sl1Hsnm4Z-CMlscbcA==/109951165229956293.jpg",
                "tns": [],
                "pic_str": "109951165229956293",
                "pic": 109951165229956290
              },
              "dt": 228016,
              "h": {
                "br": 320002,
                "fid": 0,
                "size": 9122925,
                "vd": -20209
              },
              "m": {
                "br": 192002,
                "fid": 0,
                "size": 5473773,
                "vd": -17647
              },
              "l": {
                "br": 128002,
                "fid": 0,
                "size": 3649197,
                "vd": -15993
              },
              "a": null,
              "cd": "01",
              "no": 1,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "rtype": 0,
              "rurl": null,
              "mst": 9,
              "cp": 0,
              "mv": 0,
              "publishTime": 1582214400000,
              "privilege": {
                "id": 1425099615,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 999000,
                "fl": 128000,
                "toast": false,
                "flag": 2,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "1229CEED6BB05E9B6A5C352212E553A8",
          "durationms": 43457,
          "playTime": 73400,
          "praisedCount": 268,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_D2C4FF5A91F9D502F6B3B488CF76D30C",
          "coverUrl": "https://p1.music.126.net/HOyn8J6ncetrrFvvT0gE2w==/109951163918837781.jpg",
          "height": 960,
          "width": 544,
          "title": "后来。最扎心版本",
          "description": null,
          "commentCount": 360,
          "shareCount": 1212,
          "resolutions": [
            {
              "resolution": 240,
              "size": 656587
            },
            {
              "resolution": 480,
              "size": 550092
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 1000000,
            "authStatus": 1,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/TDTyMrMFViaOsnXY6FU4mw==/109951163657326607.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 1003200,
            "birthday": 939657600000,
            "userId": 289011451,
            "userType": 4,
            "nickname": "邛亇二",
            "signature": "这一次 无论如何 不会再把你弄丢了.",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951163657326610,
            "backgroundImgId": 109951163217485470,
            "backgroundUrl": "http://p1.music.126.net/roHnHVrHxB7yyB5eqP0Vdw==/109951163217485475.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 10,
            "vipType": 11,
            "remarkName": null,
            "avatarImgIdStr": "109951163657326607",
            "backgroundImgIdStr": "109951163217485475"
          },
          "urlInfo": {
            "id": "D2C4FF5A91F9D502F6B3B488CF76D30C",
            "url": "http://vodkgeyttp9c.vod.126.net/cloudmusic/09d1e17a3eb9b5f6430df3bb66c8fc80.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=pqicIMczYqSpRtjantaJnbKeFDFIyzDv&sign=e209fcfb1d914712afb6802f61b0c5b2&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 550092,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 480
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 254120,
              "name": "滚石唱片行",
              "alg": null
            },
            {
              "id": 57111,
              "name": "中文翻唱",
              "alg": null
            },
            {
              "id": 59111,
              "name": "素人草根",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 14146,
              "name": "兴奋",
              "alg": null
            },
            {
              "id": 16101,
              "name": "刘若英",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": [
            109
          ],
          "relateSong": [
            {
              "name": "后来",
              "id": 254574,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 8326,
                  "name": "刘若英",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": "600902000007952517",
              "fee": 8,
              "v": 51,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 25437,
                "name": "我等你",
                "picUrl": "http://p3.music.126.net/eBF7bHnJYBUfOFrJ_7SUfw==/109951163351825356.jpg",
                "tns": [],
                "pic_str": "109951163351825356",
                "pic": 109951163351825360
              },
              "dt": 341400,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 13658949,
                "vd": -3500
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 8195386,
                "vd": -1000
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 5463605,
                "vd": -2
              },
              "a": null,
              "cd": "1",
              "no": 2,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "rtype": 0,
              "rurl": null,
              "mst": 9,
              "cp": 684010,
              "mv": 5365400,
              "publishTime": 941385600000,
              "privilege": {
                "id": 254574,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 999000,
                "fl": 128000,
                "toast": false,
                "flag": 4,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "D2C4FF5A91F9D502F6B3B488CF76D30C",
          "durationms": 14800,
          "playTime": 1848841,
          "praisedCount": 8326,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_6038649B4EB3AA3AF3F7BD971F764171",
          "coverUrl": "https://p1.music.126.net/65dpWH4OK0Whcvw0ds3zXg==/109951163810164434.jpg",
          "height": 720,
          "width": 1280,
          "title": "9420-壹夏",
          "description": "喜欢听歌的小伙伴可以关注我哦，经常更新歌曲，大家有喜欢的歌可以留言 \n本期为大家带来的是《9420》希望大家喜欢。",
          "commentCount": 32,
          "shareCount": 21,
          "resolutions": [
            {
              "resolution": 240,
              "size": 10313456
            },
            {
              "resolution": 480,
              "size": 18397179
            },
            {
              "resolution": 720,
              "size": 36856679
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 610000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/ow_HS3GOZW3iG9UU7bBK-g==/109951163997507037.jpg",
            "accountStatus": 0,
            "gender": 2,
            "city": 610100,
            "birthday": 800294400000,
            "userId": 334079685,
            "userType": 0,
            "nickname": "虎牙-壹夏",
            "signature": "",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951163997507040,
            "backgroundImgId": 109951163997495410,
            "backgroundUrl": "http://p1.music.126.net/qnKxh61oK3NsvIwjYhQtbw==/109951163997495403.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951163997507037",
            "backgroundImgIdStr": "109951163997495403"
          },
          "urlInfo": {
            "id": "6038649B4EB3AA3AF3F7BD971F764171",
            "url": "http://vodkgeyttp9c.vod.126.net/vodkgeyttp8/cCS35vVp_2269780216_shd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=UrCWSaJMjpEXCcBmKiLtkQUPVQZXVNil&sign=9398f75f5e2c1d27fa179f1932cd8ac1&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 36856679,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 57111,
              "name": "中文翻唱",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "6038649B4EB3AA3AF3F7BD971F764171",
          "durationms": 213631,
          "playTime": 89724,
          "praisedCount": 372,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_53B8CFF903E49B172A4B3B5CF5A0CE47",
          "coverUrl": "https://p1.music.126.net/Od2PFVym5v8VVuq6cY7Vdw==/109951163573757456.jpg",
          "height": 1080,
          "width": 1920,
          "title": "《我想我是海》黄磊的这首歌很老，却很有味道！",
          "description": "《我想我是海》黄磊的这首歌很老，却很有味道！#夏日金曲回忆杀#",
          "commentCount": 16,
          "shareCount": 36,
          "resolutions": [
            {
              "resolution": 240,
              "size": 12292676
            },
            {
              "resolution": 480,
              "size": 18569450
            },
            {
              "resolution": 720,
              "size": 28216337
            },
            {
              "resolution": 1080,
              "size": 46110677
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 350000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/oaG0Ayb5fCL-pxuJfkBvHQ==/109951163250747026.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 350200,
            "birthday": 556470000000,
            "userId": 492688094,
            "userType": 0,
            "nickname": "赏吧音乐",
            "signature": "微博：赏吧音乐",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951163250747020,
            "backgroundImgId": 109951163250828700,
            "backgroundUrl": "http://p1.music.126.net/DHRlBHvLsoaU11mZO5mLQQ==/109951163250828698.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 10,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951163250747026",
            "backgroundImgIdStr": "109951163250828698"
          },
          "urlInfo": {
            "id": "53B8CFF903E49B172A4B3B5CF5A0CE47",
            "url": "http://vodkgeyttp9c.vod.126.net/vodkgeyttp8/DPbVs4Dg_1701615377_uhd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=VfSEyWDuVuZovCoEMozoyjEpKxvzlemz&sign=a32e42fd08d438f8322a862c46abac3b&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 46110677,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 1080
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 57111,
              "name": "中文翻唱",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "53B8CFF903E49B172A4B3B5CF5A0CE47",
          "durationms": 224938,
          "playTime": 93753,
          "praisedCount": 269,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_E445A7EBDEC9798002244F3FDA5A1A70",
          "coverUrl": "https://p1.music.126.net/OPEPJzMrwrNNAZXC97f0hA==/109951165064940718.jpg",
          "height": 540,
          "width": 1172,
          "title": "夏天的风-欧阳娜娜",
          "description": null,
          "commentCount": 28,
          "shareCount": 89,
          "resolutions": [
            {
              "resolution": 240,
              "size": 14559121
            },
            {
              "resolution": 480,
              "size": 23665188
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 440000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/FhE80o9q9nrBXqwCMtwxcA==/109951166454586029.jpg",
            "accountStatus": 0,
            "gender": 2,
            "city": 440600,
            "birthday": 1079280000000,
            "userId": 1485307687,
            "userType": 0,
            "nickname": "WYYCARRA",
            "signature": "啊，我手贱不小心点到了取消关注，关注了花花快一年了，又要重新计时😭",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951166454586030,
            "backgroundImgId": 109951166730660640,
            "backgroundUrl": "http://p1.music.126.net/Xj7wgQIZhOym4tZawF6WQg==/109951166730660640.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 10,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951166454586029",
            "backgroundImgIdStr": "109951166730660640"
          },
          "urlInfo": {
            "id": "E445A7EBDEC9798002244F3FDA5A1A70",
            "url": "http://vodkgeyttp9c.vod.126.net/cloudmusic/LfXjIX19_3031979540_hd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=dTKyGfCFRoAWiAbklmmXQKjfFZitNugg&sign=7fe0518184271ba290ab503b19f93956&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 23665188,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 480
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 57111,
              "name": "中文翻唱",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 24134,
              "name": "弹唱",
              "alg": null
            },
            {
              "id": 198121,
              "name": "欧阳娜娜",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "E445A7EBDEC9798002244F3FDA5A1A70",
          "durationms": 199169,
          "playTime": 107638,
          "praisedCount": 929,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_5E63CAB929AADB968A423F4F837EFBE1",
          "coverUrl": "https://p1.music.126.net/iL2GWA59vXRTqCwWmgpVqA==/109951163573172208.jpg",
          "height": 720,
          "width": 1280,
          "title": "英国好声音盲选 Where is the love",
          "description": "英国好声音盲选 Frances Wood翻唱Black Eyed Peas的歌曲Where is the love",
          "commentCount": 110,
          "shareCount": 146,
          "resolutions": [
            {
              "resolution": 240,
              "size": 11457794
            },
            {
              "resolution": 480,
              "size": 17027997
            },
            {
              "resolution": 720,
              "size": 27187255
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 120000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/SUeqMM8HOIpHv9Nhl9qt9w==/109951165647004069.jpg",
            "accountStatus": 0,
            "gender": 0,
            "city": 120102,
            "birthday": -2209017600000,
            "userId": 71745955,
            "userType": 0,
            "nickname": "pertllama15",
            "signature": "",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951165647004060,
            "backgroundImgId": 2002210674180201,
            "backgroundUrl": "http://p1.music.126.net/o3G7lWrGBQAvSRt3UuApTw==/2002210674180201.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": null,
            "djStatus": 0,
            "vipType": 0,
            "remarkName": null,
            "avatarImgIdStr": "109951165647004069",
            "backgroundImgIdStr": "2002210674180201"
          },
          "urlInfo": {
            "id": "5E63CAB929AADB968A423F4F837EFBE1",
            "url": "http://vodkgeyttp9c.vod.126.net/vodkgeyttp8/0xlcODN3_1363700498_shd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=fLeUxMeCpERIgrmbOehvvjXqOBWZYKyQ&sign=d10260a942d6bbbc21c34f9660f73002&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 27187255,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 720
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 57112,
              "name": "英文翻唱",
              "alg": null
            },
            {
              "id": 58109,
              "name": "国外达人",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 13164,
              "name": "快乐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "Where Is The Love?",
              "id": 16808807,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 88146,
                  "name": "Black Eyed Peas",
                  "tns": [],
                  "alias": []
                },
                {
                  "id": 35331,
                  "name": "Justin Timberlake",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": "",
              "fee": 8,
              "v": 21,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 1548454,
                "name": "Where Is The Love?",
                "picUrl": "http://p3.music.126.net/XnxVHFE9h-YtZM2paZK8Gw==/109951163116050352.jpg",
                "tns": [],
                "pic_str": "109951163116050352",
                "pic": 109951163116050350
              },
              "dt": 276000,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 11042661,
                "vd": -28800
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 6625669,
                "vd": -26300
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 4417172,
                "vd": -25400
              },
              "a": null,
              "cd": "1",
              "no": 1,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 1,
              "s_id": 0,
              "rtype": 0,
              "rurl": null,
              "mst": 9,
              "cp": 7001,
              "mv": 509055,
              "publishTime": 1055692800007,
              "privilege": {
                "id": 16808807,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 320000,
                "fl": 128000,
                "toast": false,
                "flag": 0,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "5E63CAB929AADB968A423F4F837EFBE1",
          "durationms": 102283,
          "playTime": 372580,
          "praisedCount": 1490,
          "praised": false,
          "subscribed": false
        }
      },
      {
        "type": 1,
        "displayed": false,
        "alg": "onlineHotGroup",
        "extAlg": null,
        "data": {
          "alg": "onlineHotGroup",
          "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
          "threadId": "R_VI_62_F941C348800865FF62196446A9366963",
          "coverUrl": "https://p1.music.126.net/Cz9XlJ0kiaWnyaM1n-Ru7A==/109951163938677843.jpg",
          "height": 540,
          "width": 952,
          "title": "jaldak julduk 和弦弹法",
          "description": "",
          "commentCount": 101,
          "shareCount": 513,
          "resolutions": [
            {
              "resolution": 240,
              "size": 4069453
            },
            {
              "resolution": 480,
              "size": 6366826
            }
          ],
          "creator": {
            "defaultAvatar": false,
            "province": 650000,
            "authStatus": 0,
            "followed": false,
            "avatarUrl": "http://p1.music.126.net/1CQpnd4tFoIyjDkFcaf9MQ==/109951166441328428.jpg",
            "accountStatus": 0,
            "gender": 1,
            "city": 652200,
            "birthday": 954243082174,
            "userId": 1698430677,
            "userType": 4,
            "nickname": "音乐人_拜合提亚尔",
            "signature": "音乐是我生活的一部分",
            "description": "",
            "detailDescription": "",
            "avatarImgId": 109951166441328430,
            "backgroundImgId": 109951164647083900,
            "backgroundUrl": "http://p1.music.126.net/X9VZPdghH5r7_DQJUoA4Fw==/109951164647083897.jpg",
            "authority": 0,
            "mutual": false,
            "expertTags": null,
            "experts": {
              "1": "音乐原创视频达人"
            },
            "djStatus": 0,
            "vipType": 11,
            "remarkName": null,
            "avatarImgIdStr": "109951166441328428",
            "backgroundImgIdStr": "109951164647083897"
          },
          "urlInfo": {
            "id": "F941C348800865FF62196446A9366963",
            "url": "http://vodkgeyttp9c.vod.126.net/vodkgeyttp8/h7Bxrgqn_2384932129_hd.mp4?ts=1645713214&rid=E08BCFC4ABFB202FB362DA8FDDCE81FD&rl=3&rs=VBNQcMPJgnZnfMGTAXaLBuHumMMdceQb&sign=7b80edd5eb8f66f792354fd47f5a71a0&ext=JBvJQ4vIEF7NE5G2bvT7dNyeKaLhWbdxN6PqmoF7Ow6Z7ZLQKRjvfrSlgo99H9NJ4FhMDOf4THpkCcfKOW24N1NAcw9cZFZtFjLk73ElLouWogWlSVi2xgVlb9QzhNaGxlt50TbpPoLDusAW%2B39yfjjcoliuRgrUVNkEwCXEaddrHIGr%2F6V1KkBv%2FREKvyssj5PhtTjRqPC2n1wlACGRfk04%2Foa7VNIAB96%2B8yHRwVOlVyLQikGHVmcDicI4ZVe8",
            "size": 6366826,
            "validityTime": 1200,
            "needPay": false,
            "payInfo": null,
            "r": 480
          },
          "videoGroup": [
            {
              "id": 60100,
              "name": "翻唱",
              "alg": null
            },
            {
              "id": 59110,
              "name": "国内音乐人",
              "alg": null
            },
            {
              "id": 12100,
              "name": "流行",
              "alg": null
            },
            {
              "id": 5100,
              "name": "音乐",
              "alg": null
            },
            {
              "id": 23116,
              "name": "音乐推荐",
              "alg": null
            }
          ],
          "previewUrl": null,
          "previewDurationms": 0,
          "hasRelatedGameAd": false,
          "markTypes": null,
          "relateSong": [
            {
              "name": "Jaldak Julduk",
              "id": 469699615,
              "pst": 0,
              "t": 0,
              "ar": [
                {
                  "id": 12290091,
                  "name": "Muzo",
                  "tns": [],
                  "alias": []
                }
              ],
              "alia": [],
              "pop": 100,
              "st": 0,
              "rt": null,
              "fee": 8,
              "v": 10,
              "crbt": null,
              "cf": "",
              "al": {
                "id": 35326856,
                "name": "Jaldak Julduk",
                "picUrl": "http://p4.music.126.net/t6Xf0L21CXnvKooOoioxdw==/109951164881335891.jpg",
                "tns": [],
                "pic_str": "109951164881335891",
                "pic": 109951164881335890
              },
              "dt": 133564,
              "h": {
                "br": 320000,
                "fid": 0,
                "size": 5344697,
                "vd": -25900
              },
              "m": {
                "br": 192000,
                "fid": 0,
                "size": 3206835,
                "vd": -23200
              },
              "l": {
                "br": 128000,
                "fid": 0,
                "size": 2137905,
                "vd": -21400
              },
              "a": null,
              "cd": "1",
              "no": 1,
              "rtUrl": null,
              "ftype": 0,
              "rtUrls": [],
              "djId": 0,
              "copyright": 0,
              "s_id": 0,
              "rtype": 0,
              "rurl": null,
              "mst": 9,
              "cp": 0,
              "mv": 0,
              "publishTime": 1491148800007,
              "privilege": {
                "id": 469699615,
                "fee": 8,
                "payed": 0,
                "st": 0,
                "pl": 128000,
                "dl": 0,
                "sp": 7,
                "cp": 1,
                "subp": 1,
                "cs": false,
                "maxbr": 320000,
                "fl": 128000,
                "toast": false,
                "flag": 2,
                "preSell": false
              }
            }
          ],
          "relatedInfo": null,
          "videoUserLiveInfo": null,
          "vid": "F941C348800865FF62196446A9366963",
          "durationms": 55413,
          "playTime": 299615,
          "praisedCount": 3640,
          "praised": false,
          "subscribed": false
        }
      }
    ];
  
    let {videoList} = this.data
 
    videoList.push(...datas);
    this.setData({
      videoList
    })
  },
  toSearch(){
    wx.navigateTo({
      url:'/pages/search/search'
    })
  },
  // 实现再次播放跳转到指定位置
  handleUpDate(event){
    //console.log(event);
    let videoTimeObj = {vid:event.currentTarget.id,currentTime:event.detail.currentTime}
    let { videoTimeObjList} = this.data;
    let videoItem = videoTimeObjList.find((item)=> {return item.vid == videoTimeObj.vid})
    console.log(videoItem)
    if(videoItem){ // 如果之前有  更改时间
      videoItem.currentTime = videoTimeObj.currentTime;
    }else{  //如果之前没有 加入新的视频的ID和播放时间
      videoTimeObjList.push(videoTimeObj)
    }
    this.setData({
      videoTimeObjList
    })
  },
// 视频播放结束调用的回调
  handleended(event){
    console.log(event)
    let { videoTimeObjList } = this.data;
    let xiabiao = videoTimeObjList.findIndex(item=>item.vid===event.currentTarget.id)
    videoTimeObjList.splice(xiabiao,1);
    this.setData({
      videoTimeObjList
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作  触发时页面必须要有滚动条
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数  
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})